home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / GMSMTH01.ZIP / INCLUDE / XLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-07  |  5.6 KB  |  143 lines

  1. /*----------------------------------------------------------------------
  2. ;
  3. ; XLIB - header file
  4. ;
  5. ;
  6. ;
  7. ; ****** XLIB - Mode X graphics library                ****************
  8. ; ******                                               ****************
  9. ; ****** Written By Themie Gouthas                     ****************
  10. ;
  11. ; egg@dstos3.dsto.gov.au
  12. ; teg@bart.dsto.gov.au
  13. ;
  14. ; Header file contributed by Darren Lyon (darren@nicky.DIALix.oz.au)
  15. ;
  16. ;
  17. ;  Terminology & notes:
  18. ;         VRAM ==   Video RAM
  19. ;         SRAM ==   System RAM
  20. ;         X coordinates are in pixels unless explicitly stated
  21. ;
  22. ;----------------------------------------------------------------------*/
  23.  
  24. #ifndef _XLIB_H_
  25. #define _XLIB_H_
  26.  
  27. #include <g_def.h>
  28.  
  29. #define WORD USHORT
  30.  
  31. #define X_MODE_320x200  0
  32. #define X_MODE_320x240  1
  33. #define X_MODE_360x200  2
  34. #define X_MODE_360x240  3
  35. #define X_MODE_376x282  4
  36. #define X_MODE_320x400  5
  37. #define X_MODE_320x480  6
  38. #define X_MODE_360x400  7
  39. #define X_MODE_360x480  8
  40. #define X_MODE_360x360  9
  41. #define X_MODE_376x308  10
  42. #define X_MODE_376x564  11
  43.  
  44.  
  45. #define BACKWARD 0
  46. #define FORWARD  1
  47.  
  48. #define X_MODE_INVALID  -1
  49. #define ERROR            1
  50. #define OK               0
  51.  
  52. /* FUNCTIONS =========================================================== */
  53.  
  54. extern WORD x_set_mode(
  55.         WORD mode,                /* Initialize x mode           */
  56.         WORD WidthInPixels);
  57.  
  58. extern  void x_select_default_plane( /*Enables Read/Write access to a    */
  59.                 BYTE plane);         /* a specified plane                */
  60.  
  61. extern void x_set_splitscreen(            /* set the split screen start  */
  62.         WORD line);               /*scan line (initialize)       */
  63.  
  64. extern void x_set_start_addr(
  65.         WORD X,                   /* Set the screen start        */
  66.         WORD Y);                  /* address in video ram        */
  67.  
  68. extern void x_hide_splitscreen(void); /* Disable the split screen (Split */
  69.                                       /* Screen RAM remains reserved)    */
  70.  
  71. extern void x_show_splitscreen(void); /* Enable the split screen (given it */
  72.                                       /* was previously "hidden")          */
  73.  
  74.  
  75. extern void x_adjust_splitscreen(   /* Adjust the start scan line of the */
  76.                 WORD line);         /* split screen                      */
  77.  
  78.  
  79. extern WORD x_set_doublebuffer(     /* Enable double buffering with a    */
  80.                 WORD PageHeight);   /* specified page height             */
  81.  
  82.  
  83. extern void x_page_flip(        /* Swap visible page (only when double   */
  84.                 WORD X,         /* buffering is active) & sets virt start*/
  85.                 WORD Y);
  86.  
  87. extern void x_set_cliprect(    /* Define the clipping rectangle */
  88.                 WORD left,     /* NOTE: left and right are in bytes */
  89.                 WORD top,
  90.                 WORD righ,
  91.                 WORD bottom);
  92.  
  93. extern void x_text_mode(void);  /* return to text mode */
  94. extern void x_wait_vsync(void);  /* wait for vsync */
  95.  
  96.  
  97. /* VARIABLES =========================================================== */
  98.  
  99. extern BYTE InGraphics;             /* non zero if in X graphics mode      */
  100. extern WORD CurrXMode;              /* contains current X graphics mode id */
  101. extern WORD ScrnPhysicalByteWidth;  /* Physical screen width in bytes      */
  102. extern WORD ScrnPhysicalPixelWidth; /* Physical screen width in pixels     */
  103. extern WORD ScrnPhysicalHeight;     /* Physical screen height in pixels    */
  104. extern WORD ErrorValue;             /* Error return value                  */
  105. extern WORD SplitScrnOffs;          /* Offset in VRAM  of split screen     */
  106. extern WORD SplitScrnScanLine;      /* Scan line split screen starts at    */
  107.                     /* initially. Resizing the split scrn  */
  108.                     /* using the other functions does not  */
  109.                     /* change this value                   */
  110. extern WORD SplitScrnVisibleHeight; /* Height of the visible portion of the*/
  111.                     /* split screen.                       */
  112. extern WORD Page0_Offs;             /* Offset in VRAM of main virt. screen */
  113. extern WORD Page1_Offs;             /* Offset in VRAM of 2nd virt. screen  */
  114. extern WORD ScrnLogicalByteWidth;   /* Virtual screen width in bytes       */
  115. extern WORD ScrnLogicalPixelWidth;  /* Virtual screen width in pixels      */
  116. extern WORD ScrnLogicalHeight;      /* Virtual screen height in pixels     */
  117. extern WORD MaxScrollX;             /* Max X position of physical screen   */
  118.                                     /*  within virtual screen              */
  119. extern WORD MaxScrollY;             /* Max Y position of physical screen   */
  120.                                     /*  within virtual screen              */
  121. extern WORD DoubleBufferActive;     /* Indicates whether double buffering  */
  122.                                     /* is active                           */
  123. extern WORD VisiblePageIdx;         /* Index number of visible page 0 or 1 */
  124. extern WORD HiddenPageOffs;         /* Offset of Hidden Pg | only valid    */
  125. extern WORD VisiblePageOffs;        /* Offset of Visible Pg| for D.B. mode */
  126. extern WORD NonVisual_Offs;         /* Offset of first non-visible VRAM    */
  127.  
  128. extern WORD TopClip;                /* Clipping rectangle                  */
  129. extern WORD BottomClip;
  130. extern WORD LeftClip;
  131. extern WORD RightClip;
  132.  
  133. extern WORD PhysicalStartPixelX;    /* Coordinates of physical (visible) */
  134. extern WORD PhysicalStartByteX;     /* screen relative to the virtual    */
  135. extern WORD PhysicalStartY;         /* screen's U.L. corner              */
  136.  
  137. extern WORD PhysScrnXOffs;          /* for x_page_flip */
  138. extern WORD PhysScrnYOffs;          /* for x_page_flip */
  139.  
  140. #endif
  141.  
  142.  
  143.